﻿using System;
using System.Collections.Generic;
using TaleWorlds.CampaignSystem;

namespace MarriageFertility.Missions;

public static class DuelManager
{
    public const string MdMenu = "MarriageFertilityDuel";

    public enum DuelFightResultEnum
    {
        None,
        PlayerWon,
        PlayerLost,
    }
    
    public enum DuelFightTypeEnum
    {
        Single,
        Multiple
    }

    public static DuelFightResultEnum DuelFightResult;
    
    public static DuelFightTypeEnum DuelFightType;

    public static CharacterObject DuelHero;

    public static readonly List<CharacterObject> DuelEnemies=new ();

    public static Action WinCallEvent;

    public static Action LoseCallEvent;

    public static string DuelMenuTitle;
    
    public static void SetDuelMissionResult(bool playerWon)
    {
        if (playerWon)
            DuelFightResult = DuelFightResultEnum.PlayerWon;
        else
            DuelFightResult = DuelFightResultEnum.PlayerLost;
    }

    public static void CallBackEndEvent(bool isWin)
    {
        if (isWin && WinCallEvent != null) WinCallEvent();
        if (!isWin && LoseCallEvent != null) LoseCallEvent();
        WinCallEvent = LoseCallEvent = null;
    }
}